<template>
    <el-table :data="newsStore.newslist" style="width: 100%">
        <el-table-column prop="title" label="新闻标题" width="180" />
        <el-table-column prop="category" label="新闻类别" width="180" />
        <el-table-column prop="content" label="新闻内容" width="180" />
        <!-- 自定义列 -->
        <el-table-column label="操作">
            <template #default="scope">
                <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
            </template>
        </el-table-column>
    </el-table>
</template>

<script setup>
import useNewsStore from '../store/newsStore';

const newsStore = useNewsStore()

const handleEdit = (index, row) => {
    console.log(index, row)
}
const handleDelete = (index, row) => {
    console.log(index, row)
}
</script>
